Skip to content

Conversation

@michelle0927
Copy link
Collaborator

@michelle0927 michelle0927 commented Oct 23, 2025

Resolves #18792

Summary by CodeRabbit

  • New Features

    • Add SharePoint actions: Create Folder, Create Link, Upload File, Find File by Name, Get Excel Table, Get File by ID, List Files in Folder.
    • Add event sources: New File Created, New Folder Created.
  • Improvements

    • Expanded file/folder/table selection and filtering options; optional header/row controls for Excel retrieval.
    • Component version bumped to 0.4.0 and several action/source versions incremented.

@vercel
Copy link

vercel bot commented Oct 23, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
pipedream-docs Ignored Ignored Oct 23, 2025 6:14pm
pipedream-docs-redirect-do-not-edit Ignored Ignored Oct 23, 2025 6:14pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 23, 2025

Walkthrough

Adds multiple SharePoint features: seven new action modules (folder/file/upload/share/search/excel), two new event sources (new file/folder created), shared constants, enhancements to the SharePoint app (new prop definitions and API helper methods), common source tweaks, and several version bumps.

Changes

Cohort / File(s) Summary
New Action Modules
components/sharepoint/actions/create-folder/create-folder.mjs, components/sharepoint/actions/create-link/create-link.mjs, components/sharepoint/actions/find-file-by-name/find-file-by-name.mjs, components/sharepoint/actions/get-excel-table/get-excel-table.mjs, components/sharepoint/actions/get-file-by-id/get-file-by-id.mjs, components/sharepoint/actions/list-files-in-folder/list-files-in-folder.mjs, components/sharepoint/actions/upload-file/upload-file.mjs
Added seven action definitions implementing create-folder, create-link, find-file-by-name, get-excel-table, get-file-by-id, list-files-in-folder, and upload-file. Each exports a default action object with props wired to sharepoint app definitions and run() logic that calls new sharepoint app helper methods and exports summaries on success.
New Event Source Modules
components/sharepoint/sources/new-file-created/new-file-created.mjs, components/sharepoint/sources/new-folder-created/new-folder-created.mjs
Added two sources extending common with props (siteId, driveId, folderId), resource selection (listDriveItems or listDriveItemsInFolder), timestamp ordering, relevance filters (file vs folder), and metadata generation for emitted events.
Core App & API Helpers
components/sharepoint/sharepoint.app.mjs
Extended propDefinitions (folderId, excelFileId, tableName, excludeFolders), generalized header handling, updated _makeRequest signature, and added public helper methods: listDriveItemsInFolder, createDriveItem, createDriveItemInFolder, createLink, listExcelTables, getExcelTable, uploadFile, getDriveItem.
Shared Constants
components/sharepoint/common/constants.mjs
Added SHARING_LINK_TYPE_OPTIONS and SHARING_LINK_SCOPE_OPTIONS and exported them via default export.
Common Source Changes
components/sharepoint/sources/common/common.mjs
Added isSortedDesc() and isRelevant() methods; updated run logic to initialize count, honor isRelevant filtering, limit emissions to 10 items after lastTs, and break early when sorted descending.
Version Bumps & Minor Edits
components/sharepoint/actions/create-item/create-item.mjs, components/sharepoint/actions/create-list/create-list.mjs, components/sharepoint/actions/download-file/download-file.mjs, components/sharepoint/actions/update-item/update-item.mjs, components/sharepoint/sources/new-list-item/new-list-item.mjs, components/sharepoint/sources/updated-list-item/updated-list-item.mjs, components/sharepoint/package.json
Incremented package/component and action/source version strings; corrected descriptions for list item sources.

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant Action as Action Module
    participant SharePoint as SharePoint App
    participant API as Microsoft Graph API

    User->>Action: Invoke action (e.g., Create Folder / Upload / Create Link)
    Action->>Action: Read props (siteId, driveId, folderId, fileId, etc.)
    alt Action targets folder
        Action->>SharePoint: createDriveItemInFolder(siteId, folderId, payload)
    else Action targets drive root or file
        Action->>SharePoint: createDriveItem / uploadFile / createLink / getExcelTable(...)
    end
    SharePoint->>API: HTTP request (Graph API)
    API-->>SharePoint: Response (includes item id/data)
    SharePoint-->>Action: Return response
    Action->>Action: Export $summary if id present
    Action-->>User: Return response
Loading
sequenceDiagram
    participant Poller as Source (Poll)
    participant SharePoint as SharePoint App
    participant API as Microsoft Graph API
    participant Pipeline as Event Pipeline

    loop Polling
        Poller->>SharePoint: getResourceFn() -> listDriveItems...({ params: orderby lastModifiedDateTime desc })
        SharePoint->>API: GET items
        API-->>SharePoint: Items (sorted)
        SharePoint-->>Poller: Items
        Poller->>Poller: Filter by isRelevant(item)
        Poller->>Poller: Keep items with ts > lastTs, max 10
        loop For each item
            Poller->>Poller: generateMeta(item)
            Poller->>Pipeline: Emit event (id, summary, ts)
        end
        Poller->>Poller: Update lastTs
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~30 minutes

Multiple new modules follow consistent patterns but require per-file verification (props wiring, API helper correctness, header handling) and testing of new app helper methods and sources.

Poem

🐰
In burrows where the code-lines play,
I plant new folders, safe and gay.
Links and uploads hop into light,
Tables and files dance through the night.
SharePoint grows — a warren bright.

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The pull request description provided is minimal, containing only "Resolves #18792" and does not follow the required template structure that specifies a "WHY" section for explanation. The description lacks substantive context about the rationale, changes, or impact of the PR beyond linking to the issue. While the issue reference is helpful for tracing intent, the description is substantially incomplete relative to the template requirements and fails to provide the contextual information that would help reviewers understand the scope and purpose of these changes. The author should expand the pull request description to include the required "WHY" section from the template, explaining the rationale behind adding these new SharePoint components. This should summarize how the changes address the feature request in issue #18792 to expand SharePoint functionality to be comparable to OneDrive, making it easier for reviewers to understand the intent and scope of the work.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The pull request title "Sharepoint - new components" accurately reflects the main objective of the changeset, which introduces multiple new SharePoint actions and sources to expand the component library. The title is concise and directly communicates the primary change. While slightly generic by using "components" rather than specifying "actions and sources," the title is sufficiently clear and specific enough for a developer scanning the commit history to understand that new functionality is being added to SharePoint integration.
Linked Issues Check ✅ Passed The PR substantially addresses the objectives stated in linked issue #18792. The changeset introduces seven new SharePoint actions (create-folder, create-link, find-file-by-name, get-excel-table, get-file-by-id, list-files-in-folder, upload-file) and two new sources (new-file-created, new-folder-created), directly fulfilling the request to expand SharePoint actions and triggers to be comparable to OneDrive. The supporting infrastructure changes—including extensions to the sharepoint.app.mjs module with new API methods, new prop definitions, and constant definitions for sharing options—enable these new components to function correctly. The version bump from 0.3.3 to 0.4.0 reflects the magnitude of the expansion.
Out of Scope Changes Check ✅ Passed The changes in this PR are all directly aligned with the objective to expand SharePoint functionality. The new action modules (create-folder, create-link, find-file-by-name, get-excel-table, get-file-by-id, list-files-in-folder, upload-file) and new source modules (new-file-created, new-folder-created) are core to the feature request. Supporting changes such as updates to sharepoint.app.mjs (adding API methods), constants.mjs (adding sharing link options), and version updates to existing components all directly support the expansion of SharePoint capabilities. Refinements to existing source descriptions and common source logic also support the overall objective without introducing unrelated functionality.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch issue-18792

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 09b338b and 45ff289.

📒 Files selected for processing (2)
  • components/sharepoint/actions/create-folder/create-folder.mjs (1 hunks)
  • components/sharepoint/actions/get-file-by-id/get-file-by-id.mjs (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • components/sharepoint/actions/create-folder/create-folder.mjs
  • components/sharepoint/actions/get-file-by-id/get-file-by-id.mjs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Publish TypeScript components
  • GitHub Check: pnpm publish
  • GitHub Check: Verify TypeScript components
  • GitHub Check: Lint Code Base

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 11

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
components/sharepoint/sharepoint.app.mjs (2)

409-416: Encode search query to avoid breaking path and potential injection issues

Interpolate with encodeURIComponent.

-        path: `/sites/${siteId}/drive/root/search(q='${query}')`,
+        path: `/sites/${siteId}/drive/root/search(q='${encodeURIComponent(query)}')`,

97-104: Guard: require both siteId and listId when listing items

Prevents requests like /lists/undefined/items.

-        if (!siteId) {
+        if (!siteId || !listId) {
           return [];
         }
🧹 Nitpick comments (9)
components/sharepoint/sharepoint.app.mjs (3)

383-385: Encode tableName in path

Table names can contain spaces or special chars.

-        path: `/sites/${siteId}/drive/items/${itemId}/workbook/tables/${tableName}/range`,
+        path: `/sites/${siteId}/drive/items/${itemId}/workbook/tables/${encodeURIComponent(tableName)}/range`,

391-394: Prefer encodeURIComponent for file names

Safer for special characters.

-          ? `/sites/${siteId}/drives/${driveId}/items/${uploadFolderId}:/${encodeURI(name)}:/content`
-          : `/sites/${siteId}/drives/${driveId}/root:/${encodeURI(name)}:/content`,
+          ? `/sites/${siteId}/drives/${driveId}/items/${uploadFolderId}:/${encodeURIComponent(name)}:/content`
+          : `/sites/${siteId}/drives/${driveId}/root:/${encodeURIComponent(name)}:/content`,

255-260: Align description and behavior: set explicit default for excludeFolders

Description says default is false; make it explicit.

     excludeFolders: {
       type: "boolean",
       label: "Exclude Folders?",
       description: "Set to `true` to return only files in the response. Defaults to `false`",
       optional: true,
+      default: false,
     },
components/sharepoint/actions/create-item/create-item.mjs (1)

64-70: Pass $ to app method for consistent logging/error context

Keeps Axios scoped to the step context, matching other actions.

-    const response = await this.sharepoint.createItem({
-      siteId: this.siteId,
-      listId: this.listId,
-      data: {
-        fields,
-      },
-    });
+    const response = await this.sharepoint.createItem({
+      $,
+      siteId: this.siteId,
+      listId: this.listId,
+      data: { fields },
+    });
components/sharepoint/actions/list-files-in-folder/list-files-in-folder.mjs (1)

48-66: Optional: add pagination support

Current implementation returns only the first page. Consider using sharepoint.paginate to stream all items or expose a top limit.

components/sharepoint/actions/get-excel-table/get-excel-table.mjs (1)

72-83: Defensive: fall back to values when text is absent and keep row semantics

Some workbooks may not populate text. This keeps behavior consistent.

-    const response = this.removeHeaders
-      ? this.numberOfRows <= 0
-        ? range.text.slice(1)
-        : range.text.slice(1, this.numberOfRows + 1)
-      : this.numberOfRows <= 0
-        ? range.text
-        : range.text.slice(0, this.numberOfRows + 1);
+    const rows = Array.isArray(range?.text) ? range.text
+      : Array.isArray(range?.values) ? range.values
+      : [];
+    const response = this.removeHeaders
+      ? (this.numberOfRows <= 0
+        ? rows.slice(1)
+        : rows.slice(1, this.numberOfRows + 1))
+      : (this.numberOfRows <= 0
+        ? rows
+        : rows.slice(0, this.numberOfRows + 1));
components/sharepoint/sources/new-folder-created/new-folder-created.mjs (1)

7-7: Nit: brand casing.

“SharePoint” (capital P).

-  description: "Emit new event when a new folder is created in Microsoft Sharepoint.",
+  description: "Emit new event when a new folder is created in Microsoft SharePoint.",
components/sharepoint/common/constants.mjs (1)

1-14: Gate “embed” when not OneDrive personal; consider “users” scope.

Expose embed only when target is personal OneDrive; SharePoint/ODB will reject it. Optionally add users scope in the future for specific people links.

If you keep embed, please add a runtime guard in the action to fail fast when the drive isn’t personal. Also confirm the desired scope surface (only anonymous / organization).

Also applies to: 16-25, 27-30

components/sharepoint/actions/upload-file/upload-file.mjs (1)

7-8: Clarify scope in description.

It uploads to SharePoint/OneDrive.

-  description: "Upload a file to OneDrive. [See the documentation](https://learn.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_put_content?view=odsp-graph-online)",
+  description: "Upload a file to SharePoint / OneDrive. [See the documentation](https://learn.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_put_content?view=odsp-graph-online)",
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b42b428 and 09b338b.

📒 Files selected for processing (19)
  • components/sharepoint/actions/create-folder/create-folder.mjs (1 hunks)
  • components/sharepoint/actions/create-item/create-item.mjs (1 hunks)
  • components/sharepoint/actions/create-link/create-link.mjs (1 hunks)
  • components/sharepoint/actions/create-list/create-list.mjs (1 hunks)
  • components/sharepoint/actions/download-file/download-file.mjs (1 hunks)
  • components/sharepoint/actions/find-file-by-name/find-file-by-name.mjs (1 hunks)
  • components/sharepoint/actions/get-excel-table/get-excel-table.mjs (1 hunks)
  • components/sharepoint/actions/get-file-by-id/get-file-by-id.mjs (1 hunks)
  • components/sharepoint/actions/list-files-in-folder/list-files-in-folder.mjs (1 hunks)
  • components/sharepoint/actions/update-item/update-item.mjs (1 hunks)
  • components/sharepoint/actions/upload-file/upload-file.mjs (1 hunks)
  • components/sharepoint/common/constants.mjs (1 hunks)
  • components/sharepoint/package.json (1 hunks)
  • components/sharepoint/sharepoint.app.mjs (4 hunks)
  • components/sharepoint/sources/common/common.mjs (2 hunks)
  • components/sharepoint/sources/new-file-created/new-file-created.mjs (1 hunks)
  • components/sharepoint/sources/new-folder-created/new-folder-created.mjs (1 hunks)
  • components/sharepoint/sources/new-list-item/new-list-item.mjs (1 hunks)
  • components/sharepoint/sources/updated-list-item/updated-list-item.mjs (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (7)
components/sharepoint/sources/common/common.mjs (1)
components/sharepoint/sources/updated-list-item/updated-list-item.mjs (1)
  • ts (47-47)
components/sharepoint/actions/list-files-in-folder/list-files-in-folder.mjs (2)
components/sharepoint/actions/create-folder/create-folder.mjs (1)
  • response (54-64)
components/sharepoint/sharepoint.app.mjs (8)
  • response (17-17)
  • response (48-48)
  • response (80-80)
  • response (107-107)
  • response (136-136)
  • response (160-171)
  • values (172-172)
  • values (202-204)
components/sharepoint/actions/create-folder/create-folder.mjs (2)
components/sharepoint/actions/create-item/create-item.mjs (1)
  • response (64-70)
components/sharepoint/actions/list-files-in-folder/list-files-in-folder.mjs (1)
  • response (49-59)
components/sharepoint/actions/upload-file/upload-file.mjs (3)
components/sharepoint/actions/create-folder/create-folder.mjs (1)
  • response (54-64)
components/sharepoint/actions/download-file/download-file.mjs (1)
  • response (54-59)
components/sharepoint/sharepoint.app.mjs (6)
  • response (17-17)
  • response (48-48)
  • response (80-80)
  • response (107-107)
  • response (136-136)
  • response (160-171)
components/sharepoint/actions/get-file-by-id/get-file-by-id.mjs (1)
components/sharepoint/actions/download-file/download-file.mjs (1)
  • response (54-59)
components/sharepoint/actions/find-file-by-name/find-file-by-name.mjs (2)
components/sharepoint/actions/list-files-in-folder/list-files-in-folder.mjs (2)
  • response (49-59)
  • values (60-62)
components/sharepoint/sharepoint.app.mjs (8)
  • response (17-17)
  • response (48-48)
  • response (80-80)
  • response (107-107)
  • response (136-136)
  • response (160-171)
  • values (172-172)
  • values (202-204)
components/sharepoint/sharepoint.app.mjs (9)
components/sharepoint/actions/create-folder/create-folder.mjs (1)
  • response (54-64)
components/sharepoint/actions/create-link/create-link.mjs (1)
  • response (58-66)
components/sharepoint/actions/download-file/download-file.mjs (1)
  • response (54-59)
components/sharepoint/actions/find-file-by-name/find-file-by-name.mjs (2)
  • response (35-39)
  • values (40-42)
components/sharepoint/actions/get-file-by-id/get-file-by-id.mjs (1)
  • response (44-48)
components/sharepoint/actions/list-files-in-folder/list-files-in-folder.mjs (2)
  • response (49-59)
  • values (60-62)
components/sharepoint/actions/upload-file/upload-file.mjs (2)
  • response (71-78)
  • name (69-69)
components/microsoft_outlook/sources/common/common-new-email.mjs (1)
  • folder (45-45)
components/sharepoint/sources/common/common.mjs (1)
  • args (50-50)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: pnpm publish
  • GitHub Check: Lint Code Base
  • GitHub Check: Verify TypeScript components
  • GitHub Check: Publish TypeScript components
🔇 Additional comments (14)
components/sharepoint/actions/download-file/download-file.mjs (1)

8-8: LGTM! Routine version bump.

Version bump aligns with the broader SharePoint component expansion in this PR.

components/sharepoint/actions/create-list/create-list.mjs (1)

7-7: LGTM! Routine version bump.

Version increment is consistent with the PR's updates to the SharePoint integration.

components/sharepoint/package.json (1)

3-3: LGTM! Appropriate minor version bump.

The bump from 0.3.3 to 0.4.0 correctly signals the addition of new SharePoint actions and sources in this PR.

components/sharepoint/actions/update-item/update-item.mjs (1)

8-8: LGTM! Routine version bump.

Version increment aligns with the PR's component updates.

components/sharepoint/sources/updated-list-item/updated-list-item.mjs (1)

7-8: LGTM! Clarified description.

The description now correctly indicates the source emits events for list item updates rather than list updates, improving clarity.

components/sharepoint/sources/common/common.mjs (2)

26-31: LGTM! Extension points for derived sources.

These methods provide customization hooks for sources to control sorting order and item relevance filtering.


56-69: LGTM! Enhanced emission logic with first-run protection.

The changes add:

  • First-run protection: limits to 10 items when lastTs is falsy
  • Filtering: respects isRelevant() for item selection
  • Early exit: breaks when items are sorted descending and timestamp threshold is reached

This prevents overwhelming users with historical data on initial runs while maintaining flexibility for derived sources.

components/sharepoint/sources/new-list-item/new-list-item.mjs (1)

7-8: LGTM! Clarified description.

The description now correctly indicates the source emits events for new list items rather than new lists, improving accuracy and consistency with the updated-list-item source.

components/sharepoint/actions/create-item/create-item.mjs (1)

7-7: Version bump noted

No issues with the metadata change.

components/sharepoint/actions/find-file-by-name/find-file-by-name.mjs (1)

35-42: Guard empty name, add select params to trim payload; confirm single-page results are acceptable.

searchDriveItems does not auto-paginate—it returns a single response. For "find-file-by-name," verify that single-page results are sufficient or implement pagination handling if needed.

Apply:

   async run({ $ }) {
+    const query = (this.name || "").trim();
+    if (!query) throw new Error("File Name is required.");
     const response = await this.sharepoint.searchDriveItems({
       $,
       siteId: this.siteId,
-      query: this.name,
+      query,
+      params: { select: "id,name,folder" },
     });
     let values = response.value.filter(
-      ({ name }) => name.toLowerCase().includes(this.name.toLowerCase()),
+      ({ name }) => name?.toLowerCase().includes(query.toLowerCase()),
     );
components/sharepoint/actions/create-link/create-link.mjs (1)

57-70: Add validation guard for unsupported embed type; include URL in summary.

The embed sharing link type is only supported on personal OneDrive files per the Microsoft Graph API. This SharePoint action uses siteId (not personal OneDrive), so embed will fail at the API level. Adding early validation improves UX. Additionally, the API response includes link.webUrl, which should be exported in the summary.

Note: driveId is used for dynamic filtering but is not required by createLink()—the method uses the site-based path /sites/{siteId}/drive/items/{fileId}/createLink.

   async run({ $ }) {
+    if (this.type === "embed") {
+      throw new Error("Embed links are only supported for personal OneDrive files.");
+    }
     const response = await this.sharepoint.createLink({
       $,
       siteId: this.siteId,
       fileId: this.fileId,
       data: {
         type: this.type,
         scope: this.scope,
       },
     });
 
     if (response?.id) {
-      $.export("$summary", `Successfully created a sharing link with ID \`${response.id}\`.`);
+      const url = response?.link?.webUrl;
+      $.export("$summary", `Created sharing link ${response.id}${url ? ` → ${url}` : ""}.`);
     }
components/sharepoint/sources/new-file-created/new-file-created.mjs (3)

3-10: LGTM! Metadata is well-defined.

The component metadata follows standard patterns with appropriate dedupe strategy and clear naming.


11-38: LGTM! Props are correctly configured.

The prop definitions properly chain dependencies (driveId → siteId, folderId → siteId + driveId) and reference the SharePoint app propDefinitions correctly.


62-63: LGTM! File filtering logic is correct.

The isRelevant method correctly filters to only items with a file property, excluding folders.

@vunguyenhung vunguyenhung merged commit e874d14 into master Oct 24, 2025
10 checks passed
@vunguyenhung vunguyenhung deleted the issue-18792 branch October 24, 2025 01:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Sharepoint expansion

3 participants